package com.lry.crawlers.fiction.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lry.crawlers.fiction.entity.FictionUpdate;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface FictionUpdateMapper extends BaseMapper<FictionUpdate> {

    @Update("update fiction_update set deleted=1 where DATE_SUB(CURDATE(), INTERVAL (select fiction_close_up_time from config) DAY) > date(update_time)")
    void updateTime();

    @Update("update fiction_update set chapter_num = chapter_num+1  where fiction_id=#{fictionId}")
    int setFictionUpdateAddNum(@Param("fictionId")String fictionId);
}
